home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / interfac.ads < prev    next >
Text File  |  1996-01-30  |  6KB  |  175 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --                           I N T E R F A C E S                            --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.9 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18. --  At the moment there is only one version of this source package available.
  19. --  It assumes integer sizes of 8, 16, 32 and 64 are available, and that the
  20. --  floating-point formats are IEEE compatible. Specialization of this file
  21. --  may be required later if these assumptions are not correct for some target.
  22.  
  23. package Interfaces is
  24. pragma Pure (Interfaces);
  25.  
  26.    type Integer_8  is range -2 **  7 .. 2 **  7 - 1;
  27.    for Integer_8'Size use  8;
  28.  
  29.    type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1;
  30.    for Integer_16'Size use 16;
  31.  
  32.    type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1;
  33.    for Integer_32'Size use 32;
  34.  
  35.    type Integer_64 is range -2 ** 63 .. 2 ** 63 - 1;
  36.    for Integer_64'Size use 64;
  37.  
  38.    type Unsigned_8  is mod 2 **  8;
  39.    for Unsigned_8'SIze use  8;
  40.  
  41.    type Unsigned_16 is mod 2 ** 16;
  42.    for Unsigned_16'SIze use 16;
  43.  
  44.    type Unsigned_32 is mod 2 ** 32;
  45.    for Unsigned_32'SIze use 32;
  46.  
  47.    type Unsigned_64 is mod 2 ** 64;
  48.    for Unsigned_64'Size use 64;
  49.  
  50.    function Shift_Left
  51.      (Value  : Unsigned_8;
  52.       Amount : Natural)
  53.      return    Unsigned_8;
  54.  
  55.    function Shift_Right
  56.      (Value  : Unsigned_8;
  57.       Amount : Natural)
  58.       return   Unsigned_8;
  59.  
  60.    function Shift_Right_Arithmetic
  61.      (Value  : Unsigned_8;
  62.       Amount : Natural)
  63.       return   Unsigned_8;
  64.  
  65.    function Rotate_Left
  66.      (Value  : Unsigned_8;
  67.       Amount : Natural)
  68.       return   Unsigned_8;
  69.  
  70.    function Rotate_Right
  71.      (Value  : Unsigned_8;
  72.       Amount : Natural)
  73.       return   Unsigned_8;
  74.  
  75.    function Shift_Left
  76.      (Value  : Unsigned_16;
  77.       Amount : Natural)
  78.      return    Unsigned_16;
  79.  
  80.    function Shift_Right
  81.      (Value  : Unsigned_16;
  82.       Amount : Natural)
  83.       return   Unsigned_16;
  84.  
  85.    function Shift_Right_Arithmetic
  86.      (Value  : Unsigned_16;
  87.       Amount : Natural)
  88.       return   Unsigned_16;
  89.  
  90.    function Rotate_Left
  91.      (Value  : Unsigned_16;
  92.       Amount : Natural)
  93.       return   Unsigned_16;
  94.  
  95.    function Rotate_Right
  96.      (Value  : Unsigned_16;
  97.       Amount : Natural)
  98.       return   Unsigned_16;
  99.  
  100.    function Shift_Left
  101.      (Value  : Unsigned_32;
  102.       Amount : Natural)
  103.      return    Unsigned_32;
  104.  
  105.    function Shift_Right
  106.      (Value  : Unsigned_32;
  107.       Amount : Natural)
  108.       return   Unsigned_32;
  109.  
  110.    function Shift_Right_Arithmetic
  111.      (Value  : Unsigned_32;
  112.       Amount : Natural)
  113.       return   Unsigned_32;
  114.  
  115.    function Rotate_Left
  116.      (Value  : Unsigned_32;
  117.       Amount : Natural)
  118.       return   Unsigned_32;
  119.  
  120.    function Rotate_Right
  121.      (Value  : Unsigned_32;
  122.       Amount : Natural)
  123.       return   Unsigned_32;
  124.  
  125.    function Shift_Left
  126.      (Value  : Unsigned_64;
  127.       Amount : Natural)
  128.      return    Unsigned_64;
  129.  
  130.    function Shift_Right
  131.      (Value  : Unsigned_64;
  132.       Amount : Natural)
  133.       return   Unsigned_64;
  134.  
  135.    function Shift_Right_Arithmetic
  136.      (Value  : Unsigned_64;
  137.       Amount : Natural)
  138.       return   Unsigned_64;
  139.  
  140.    function Rotate_Left
  141.      (Value  : Unsigned_64;
  142.       Amount : Natural)
  143.       return   Unsigned_64;
  144.  
  145.    function Rotate_Right
  146.      (Value  : Unsigned_64;
  147.       Amount : Natural)
  148.       return   Unsigned_64;
  149.  
  150.    pragma Convention (Intrinsic, Shift_Left);
  151.    pragma Convention (Intrinsic, Shift_Right);
  152.    pragma Convention (Intrinsic, Shift_Right_Arithmetic);
  153.    pragma Convention (Intrinsic, Rotate_Left);
  154.    pragma Convention (Intrinsic, Rotate_Right);
  155.  
  156.    pragma Import (Intrinsic, Shift_Left);
  157.    pragma Import (Intrinsic, Shift_Right);
  158.    pragma Import (Intrinsic, Shift_Right_Arithmetic);
  159.    pragma Import (Intrinsic, Rotate_Left);
  160.    pragma Import (Intrinsic, Rotate_Right);
  161.  
  162.    --  Floating point types. We assume that we are on an IEEE machine, and
  163.    --  that the types Short_Float and Long_Float in Standard refer to the
  164.    --  32-bit short and 64-bit long IEEE forms. Furthermore, if there is
  165.    --  an extended float, we assume that it is available as Long_Long_Float.
  166.    --  Note: it is harmless, and explicitly permitted, to include additional
  167.    --  types in interfaces, so it is not wrong to have IEEE_Extended_Float
  168.    --  defined even if the extended format is not available.
  169.  
  170.    type IEEE_Float_32       is new Short_Float;
  171.    type IEEE_Float_64       is new Long_Float;
  172.    type IEEE_Extended_Float is new Long_Long_Float;
  173.  
  174. end Interfaces;
  175.